<!-- eslint-disable vue/multi-word-component-names -->
<template>
 <div>
   <PropertyBox @xxList='oneData' :shujuList='shujuList' :title="'地产分类'" />
 </div>
</template>

<script>
import { getList, getQuantity } from '@/api/categories'
import { getPropety, getPropetyList } from '@/api/propety'
export default {
  async created () {
    const total = await getQuantity()
    const res = await getList({
      _limit: total.data,
      _start: 0
    })
    // console.log(res.data)
    this.shujuList = res.data
  },
  data () {
    return {
      shujuList: []
    }
  },
  methods: {
    async oneData (val) {
      const total = await getPropety({
        category_contains: val.id
      })
      const res = await getPropetyList({
        _limit: total.data,
        _start: 0,
        category_contains: val.id
      })
      if (res.data.length !== 0) {
        this.$store.commit('getclassifyList', res.data)
        this.$router.push('/EstateList/' + val.id)
      } else {
        this.$message.warning('没有数据了')
      }
      // console.log(val)
    }
  }
}
</script>

<style>

</style>
